GetImage(DecodingSettings,Boolean,EventHandler<ProgressEventArgs>) Method (DicomFrame)
Returns an image with overlay images of the DICOM frame.
Parameters
- progressDelegate
- Progress delegate.
- overlayAll
- A value indicating whether page must return image with overlay images.
- decodingSettings
- The decoding settings that should be used for decoding of page image.
Return Value
The image associated with this
DicomFrame object if image was loaded successfully; otherwise,
null.
This C#/VB.NET code shows how to get a DICOM image with overlays and save it as PNG file.
''' <summary>
''' Returns DICOM image with overlay objects and saves it to a PNG file.
''' </summary>
''' <param name="filePath">Path to DICOM file.</param>
''' <param name="pageIndex">Index of DICOM page.</param>
Public Sub GetAndSaveDicomImageWithOverlays(filePath As String, pageIndex As Integer)
' open DICOM file
Using dicomFile As New Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile(filePath)
' get DICOM page
Dim frame As Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFrame = DirectCast(dicomFile.Pages(pageIndex), Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFrame)
' return DICOM image with overlay objects
Using image As Vintasoft.Imaging.VintasoftImage = frame.GetImage(Nothing, True, Nothing)
' save image to a PNG file
image.Save("E:\DicomImage.png")
End Using
End Using
End Sub
/// <summary>
/// Returns DICOM image with overlay objects and saves it to a PNG file.
/// </summary>
/// <param name="filePath">Path to DICOM file.</param>
/// <param name="pageIndex">Index of DICOM page.</param>
public void GetAndSaveDicomImageWithOverlays(string filePath, int pageIndex)
{
// open DICOM file
using (Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile dicomFile =
new Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile(filePath))
{
// get DICOM page
Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFrame frame =
(Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFrame)dicomFile.Pages[pageIndex];
// return DICOM image with overlay objects
using (Vintasoft.Imaging.VintasoftImage image = frame.GetImage(null, true, null))
{
// save image to a PNG file
image.Save(@"E:\DicomImage.png");
}
}
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5